<?php
/**
 * This file is part of Task Agile.
 * Task Agile is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License.
 * Task Agile is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with Task Agile.  If not, see <http://www.gnu.org/licenses/>.
 *
 * @category   TaskAgile
 * @package    Controller
 * @copyright  Copyright (c) 20010-2010 Estrada Virtual (http://estradavirtual.com.br)
 * @license    http://www.gnu.org/licenses/gpl.txt GPLv3
 * @version    $Id$
*/
define( 'd', 'die' );

// Define path to application directory
defined('APPLICATION_PATH')
    || define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../application'));

// Define application environment
defined('APPLICATION_ENV')
    || define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'production'));

$path = array(
    realpath(APPLICATION_PATH . '/../library'),
    realpath(APPLICATION_PATH . '/modules/task/models'),
    realpath(APPLICATION_PATH . '/modules/enterprise/models'),
    get_include_path(),
);

// Ensure library/ is on include_path
set_include_path(implode(PATH_SEPARATOR, $path));

/** Zend_Application */
require_once 'Zend/Application.php';

// Create application, bootstrap, and run
$application = new Zend_Application(
    APPLICATION_ENV,
    APPLICATION_PATH . '/configs/application.ini'
);
try {
    $application->bootstrap()
                ->run();
} catch(Exception $e) {
    if (APPLICATION_ENV != 'production') {
       Zend_Debug::dump($e);
    }
}

function ver()
{
    $parar = false;

    $caminho = array_shift(debug_backtrace());
    echo '
        <div style="background-color: #ddd; color: #000; font-size: 14px;">
        <div>
            <label>
                Linha   --> <label class="valorCaminho">' . $caminho['line'] . '</label><br />
                Caminho --> <label class="valorCaminho">' . $caminho['file'] . '</label><br />
            </label>
        </div>';

    echo '<div><pre>';

    foreach( $caminho['args'] as $indice => $valor ){

        if(  $valor == 'die' ) $parar = true;
        echo '<label style="color:red; font-weight: bold;">Argumento ' . ($indice + 1) . '</label><br />';
        print_r( $valor );
        echo '<br /><br />';
    }
    echo '</div></pre></div>';

    // Verifica se é para dar o die no final
    if ($parar) {
        die;
    }
}